package com.logisticsrepair.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 材料库
 * @TableName material_library
 */
@TableName(value ="material_library")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MaterialLibraryEntity implements Serializable, Cloneable {
    /**
     * 材料编号
     */
    @TableId(value = "material_id", type = IdType.ASSIGN_ID)
    private String materialId;

    /**
     * 材料名称
     */
    @TableField(value = "material_name")
    private String materialName;

    /**
     * 材料价格
     */
    @TableField(value = "material_price")
    private Double materialPrice;

    /**
     * 材料数量
     */
    @TableField(value = "material_amount")
    private Integer materialAmount;

    /**
     * 版本控制
     */
    @TableField(value = "material_version")
    @Version
    private Integer materialVersion;

    @TableField(exist = false)
    private Integer takeAmount;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public MaterialLibraryEntity(String materialId, String materialName, Double materialPrice, Integer materialAmount, Integer materialVersion) {
        this.materialId = materialId;
        this.materialName = materialName;
        this.materialPrice = materialPrice;
        this.materialAmount = materialAmount;
        this.materialVersion = materialVersion;
    }

    @Override
    public Object clone()  {
        MaterialLibraryEntity materialLibraryEntity = null;
        try {
            materialLibraryEntity = (MaterialLibraryEntity) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return materialLibraryEntity;
    }
}